<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
      

<ui:composition template="/Template.xhtml">

<ui:define name="menu">
	<table border="0" cellpadding="0" cellspacing="0" width="100%">
		<tr height="20">
			<td background="./Images/menu_hg.jpg" width="22" />
			<td background="./Images/menu_h.jpg" width="100" />
			<td background="./Images/menu_hm01.jpg" width="40" />
			<td background="./Images/h.jpg" width="190" />
			<td background="./Images/hd.jpg" width="21" />
			<td width="164"/>
			<td background="./Images/menu_hg.jpg" width="22" />
			<td background="./Images/menu_h.jpg" width="105" />
			<td background="./Images/menu_hm00.jpg" width="40" />
			<td background="./Images/menu_h.jpg" width="130" />
			<td background="./Images/menu_hm00.jpg" width="40" />
			<td background="./Images/menu_h.jpg" width="105" />
			<td background="./Images/menu_hd.jpg" width="21" />
		</tr>
		<tr height="35">
			<td background="./Images/menu_g.jpg" width="22" />
			<td bgcolor="#C7AFBD" valign="top" align="center" width="110"><a class="menu" href="./AnnoncesRecherche.jsf">Les annonces</a></td>
			<td background="./Images/menu_m01.jpg" width="40" />
			<td bgcolor="#F8F2DA" valign="top" align="center" width="140">
				<h:form>
				<h:commandLink class="menuselect" value="Passer une annonce" action="CompteLogin" rendered="#{!compteLogin.connecte}">
					<f:setPropertyActionListener target="#{compteLogin.page}" value="1" />
				</h:commandLink>
				<h:panelGroup rendered="#{compteLogin.connecte}">
							<h:commandLink class="menuselect" value="Passer une annonce" action="#{AnnoncesSession.gotoNouvellep}" rendered="#{!compteLogin.corp}" />
							<h:commandLink class="menuselect" value="Passer une annonce" action="#{AnnoncesSession.gotoNouvellec}" rendered="#{compteLogin.corp}" />
				</h:panelGroup>
				</h:form>
			</td>
			<td background="./Images/d.jpg" width="21" />
			<td />
			<td background="./Images/menu_g.jpg" width="22" />
			<td bgcolor="#C7AFBD" valign="top" align="center" width="100">
				<h:form>
				<h:commandLink class="menu" value="Mes favoris" action="CompteLogin" rendered="#{!compteLogin.connecte}">
					<f:setPropertyActionListener target="#{compteLogin.page}" value="2" />
				</h:commandLink>
				<h:panelGroup rendered="#{compteLogin.connecte}">
					<h:commandLink class="menu" value="Mes favoris" action="AnnoncesProprietaireFavorites" rendered="#{!compteLogin.corp}" />
					<h:commandLink class="menu" value="Mes favoris" action="AnnoncesChercheurFavorites" rendered="#{compteLogin.corp}" />
				</h:panelGroup>
				</h:form>
			</td>
			<td background="./Images/menu_m00.jpg" width="40" />
			<td bgcolor="#C7AFBD" valign="top" align="center" width="100">
				<h:form>
				<h:commandLink class="menu" value="Mes annonces" action="CompteLogin" rendered="#{!compteLogin.connecte}">
					<f:setPropertyActionListener target="#{compteLogin.page}" value="3" />
				</h:commandLink>
				<h:panelGroup rendered="#{compteLogin.connecte}">
					<h:commandLink class="menu" value="Mes annonces" action="AnnoncesProprietairePerso" rendered="#{!compteLogin.corp}" />
					<h:commandLink class="menu" value="Mes annonces" action="AnnoncesChercheurPerso" rendered="#{compteLogin.corp}" />
				</h:panelGroup>
				</h:form>
			</td>
			<td background="./Images/menu_m00.jpg" width="40" />
			<td bgcolor="#C7AFBD" valign="top" align="center" width="100">
				<h:form>
				<h:commandLink class="menu" value="Mon panier" action="CompteLogin" rendered="#{!compteLogin.connecte}">
					<f:setPropertyActionListener target="#{compteLogin.page}" value="4" />
				</h:commandLink>
				<h:commandLink class="menu" value="Mon panier" action="Panier" rendered="#{compteLogin.connecte}" />
				</h:form>
			</td>
			<td background="./Images/menu_d.jpg" width="21" />
		</tr>
		<tr height="20">
			<td background="./Images/menu_bg.jpg" width="22" />
			<td background="./Images/menu_b.jpg" />
			<td background="./Images/menu_bm01.jpg" width="40" />
			<td bgcolor="#F8F2DA" />
			<td background="./Images/menu_mg1.jpg" width="21" /> 
			<td background="./Images/h.jpg"/>
			<td background="./Images/menu_md.jpg" width="22" />
			<td background="./Images/menu_b.jpg" />
			<td background="./Images/menu_bm00.jpg" width="40" />
			<td background="./Images/menu_b.jpg" />
			<td background="./Images/menu_bm00.jpg" width="40" />
			<td background="./Images/menu_b.jpg" />
			<td background="./Images/menu_bd.jpg" width="21" />
		</tr>
	</table>

</ui:define>

<ui:define name="page">
	<h1>Détail de l'annonce</h1><br/><br/>
		<table border="0" cellpadding="0" cellspacing="0" width="850">
			<tr>
				<td width="500" align="center" valign="top">
					<h:form>
						<table>
							<tr><td colspan="3"><font color="#ff0000">* Champs requis</font><br/><br/></td></tr>
							<tr>
								<td align="right" valign="top">
									Titre<font color="#ff0000">*</font>
								</td>
								<td width="15"></td>
								<td>
					                <h:inputText value="#{AnnoncesSession.annoncec.annonceentity.titre}" required="true"  id="titre"/>
								</td>
							</tr>
							<tr>	
								<td align="right" valign="top">
									Texte<font color="#ff0000">*</font>
								</td>
								<td width="15"></td>
								<td>
					                <h:inputTextarea value="#{AnnoncesSession.annoncec.annonceentity.texte}" required="true"  id="texte" cols="45" rows="20"/>
								</td>
							</tr>
							<tr>	
								<td align="right" valign="top">
									Code postal<font color="#ff0000">*</font>
									<div style="color:#aeaeac; min-width:60px; " >
										(Ex: 38920)
									</div>
								</td>
								<td width="15"></td>
								<td>
					                <h:inputText value="#{AnnoncesSession.annoncec.annonceentity.departement}" required="true"  id="departement"/>
								</td>
							</tr>	
							<tr>	
								<td align="right" valign="top">
									Ville<font color="#ff0000">*</font>
									<div style="color:#aeaeac; min-width:60px; " >
										(Ex: Crolles)
									</div>
								</td>
								<td width="15"></td>
								<td>
					                <h:inputText value="#{AnnoncesSession.annoncec.annonceentity.ville}" required="true"  id="ville"/>
								</td>
							</tr>	
						</table>
						<h3>Choisissez vos options de parution</h3>
						<h:dataTable value="#{AnnoncesSession.listeOptionsPayantesPrises}"
							var="listeOption" id="TOptionschercheur" cellspacing="0">
							<h:column>
								<f:facet name="header">Nom</f:facet>
							    #{listeOption.option.nom}
							  </h:column>
							<h:column>
								<f:facet name="header">Description</f:facet>
							    #{listeOption.option.description}
							  </h:column>
							<h:column>
								<f:facet name="header">Prix</f:facet>
							    #{listeOption.option.prix}
							  </h:column>
							  <h:column>
								<f:facet name="header">Durée de vie</f:facet>
							    #{listeOption.option.dureedevie}
							  </h:column>
							<h:column>
								<f:facet name="header">Achetée</f:facet>
								<h:selectBooleanCheckbox id="checkbox" value="#{listeOption.prise}"
									title="click it to select or deselect" />
							</h:column>
						</h:dataTable>
						
						<h:dataTable value="#{AnnoncesSession.listValeurs}"
							var="prix" id="listValeursD" cellspacing="0">
							<h:column>
								<f:facet name="header">Valeur</f:facet>
							    #{prix}Dollar - 1 EURO
							  </h:column>							 										
						</h:dataTable>
						
						
						
						<p>Attention! Les options ne seront actives qu'une fois que vous aurez payé votre panier (se rendre sur la page "Panier").
						 <br />
						 La publication de l’annonce sans options est gratuite !
						</p>
						
						<div align="right"><h:commandButton value="Valider" action="#{AnnoncesSession.saveAnnoncec}" /></div>
					</h:form>
				</td>
				<td width="20"></td>
				<td valign="top" align="center">
					<h:form  enctype="multipart/form-data">
						<table width="300">
							<tr>	
								<td align="right">
									Selectionner votre photo
								</td>
								<td width="15"></td>
								<td>
									 <p:growl id="messages" showSummary="true" showDetail="true" />			 
									 <p:fileUpload fileUploadListener="#{AnnoncesSession.uploadPhoto}" 
									   auto="true" sizeLimit="1073741824" update="messages,maphoto"
									   multiple="true" label="Parcourir..." allowTypes="*.jpg;*.png;*.gif;" 
									   description="Images" id="upphoto"/>
								</td>
							</tr>
							<tr height="20"></tr>
							<tr>
								<td colspan="3" align="center">
									<h:graphicImage id="maphoto" value="#{AnnoncesSession.photo}" style="max-width:250px;" />
								</td>
							</tr>
						</table>
					</h:form>				
									
				</td>
			</tr>	
		</table>
		<table width="800"><tr><td><div align="right"><h:form><h:commandButton value="Annuler" action="AnnoncesRecherche" /></h:form></div></td></tr></table>
		

	

</ui:define>
</ui:composition>
</html>